//
//  JKLog.swift
//  4-WKWebView
//
//  Created by 蒋鹏 on 16/9/28.
//  Copyright © 2016年 蒋鹏. All rights reserved.
//

import Foundation
import UIKit

func iOS8()->Bool{return((UIDevice.current.systemVersion as NSString).floatValue >= 8.0)}
func iOS11()->Bool{return((UIDevice.current.systemVersion as NSString).floatValue >= 11.0)}
func iOS13()->Bool{return((UIDevice.current.systemVersion as NSString).floatValue >= 13.0)}
func JK_PI() -> CGFloat {return CGFloat(Double.pi)}
func JK_PI_2() -> CGFloat {return CGFloat(Double.pi / 2)}


func JKLOG<T>(_ log : T?,className: String = #file,methodName: String = #function, lineNumber: Int = #line){
    #if DEBUG
        let filePath = className as NSString
        let filePath_copy = filePath.lastPathComponent as NSString
        let fileName = filePath_copy.deletingPathExtension
        NSLog("\n******[第\(lineNumber)行][\(fileName)  \(methodName)] ******\n \(String(describing: log ))")
    #endif
}


///------------------------------适配-----------------------------------

public let keyWindow = iOS13() ? UIApplication.shared.windows[0] : UIApplication.shared.keyWindow
/** 屏幕高度 */
public let ScreenH = UIScreen.main.bounds.size.height
/** 屏幕宽度 */
public let ScreenW = UIScreen.main.bounds.size.width

//判断是否iphoneX
public let IS_IPHONEX :Bool =  ScreenH >= 812.0 ? true : false
public let NAVBAR_HEIGHT :CGFloat = IS_IPHONEX ? 88.0 : 64.0 //顶部
public let TABBAR_HEIGHT :CGFloat = IS_IPHONEX ? (49.0+34.0) : 49.0 //带tabrbar
public let STATUSBAR_HEIGHT :CGFloat = IS_IPHONEX ? 44.0 : 20.0 ///状态栏
public let MARGIN_BOTTOM :CGFloat = IS_IPHONEX ? 34.0 : 0.0 //底部
///最顶部
public let MARGIN_TOP :CGFloat = IS_IPHONEX ? 24.0 : 0.0
public let SCAL:CGFloat = IS_IPHONEX ? 1.1 : 1.0
///设定的
public let PionWidth:CGFloat = ((ScreenW/375*1.0)*10).rounded()*0.1
//let PionHeight:CGFloat = PionWidth

public let tempPionHeight:CGFloat = IS_IPHONEX ? (ScreenH-STATUSBAR_HEIGHT-MARGIN_BOTTOM)/((667-20)*SCAL) : (ScreenH-STATUSBAR_HEIGHT-MARGIN_BOTTOM)/((667-20)*PionWidth)*PionWidth

public let PionHeight:CGFloat =  ((tempPionHeight)*10).rounded()*0.1
